]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dialog: Handle key events on self
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 28 Jan 2022 10:59:51 +0000 (11:59 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 29 Jan 2022 00:16:30 +0000 (01:16 +0100)
And set the dialog actor reactive. Specifically, we do not know whether
the parent actor is reactive or not, and we should not be changing that
from here, so do not use that actor to handle key events.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>

js/ui/dialog.js

index 9513a8151a0fbafe6d68c83e1ef4a83c9062ba53..a62a3a35b0b5d62480bab6b52a5a8a0f3d3873e6 100644 (file)
@@ -13,7 +13,10 @@ function _setLabel(label, value) {
 var Dialog = GObject.registerClass(
 class Dialog extends St.Widget {
     _init(parentActor, styleClass) {
-        super._init({ layout_manager: new Clutter.BinLayout() });
+        super._init({
+            layout_manager: new Clutter.BinLayout(),
+            reactive: true,
+        });
         this.connect('destroy', this._onDestroy.bind(this));
 
         this._initialKeyFocus = null;
@@ -27,7 +30,6 @@ class Dialog extends St.Widget {
             this._dialog.add_style_class_name(styleClass);
 
         this._parentActor = parentActor;
-        this._eventId = this._parentActor.connect('event', this._modalEventHandler.bind(this));
         this._parentActor.add_child(this);
     }
 
@@ -70,7 +72,7 @@ class Dialog extends St.Widget {
         this.makeInactive();
     }
 
-    _modalEventHandler(actor, event) {
+    vfunc_event(event) {
         if (event.type() == Clutter.EventType.KEY_PRESS) {
             this._pressedKey = event.get_key_symbol();
         } else if (event.type() == Clutter.EventType.KEY_RELEASE) {